package com.gotokeep.keep.composition;

import android.media.MediaCodec;
import android.opengl.GLES11Ext;
import android.opengl.GLES20;

import java.nio.ByteBuffer;

/**
 * Renderer, Filter, Transition are all RenderNode that has one or more input and one output。
 * Input and output of RenderNode are both decoded data.
 * @author xana/cuixianming
 * @version 1.0
 * @since 2018-05-04 17:06
 */
public interface RenderNode {
    /**
     * 设置渲染节点的输入
     *
     * @param inputIndex 输入编号
     * @param textureType 纹理类型，{@link GLES20#GL_TEXTURE_2D} 或 {@link GLES11Ext#GL_TEXTURE_BINDING_EXTERNAL_OES}
     * @param textureId 纹理id
     */
    void setVideoInputTexture(int inputIndex, int textureType, int textureId);

    /**
     * 设置渲染节点的输出
     *
     * @param textureType 纹理类型，{@link GLES20#GL_TEXTURE_2D} 或 {@link GLES11Ext#GL_TEXTURE_BINDING_EXTERNAL_OES}
     * @param textureId 纹理id
     */
    void setVideoOutputTexture(int textureType, int textureId);

    void writeAudioData(ByteBuffer sampleData, MediaCodec.BufferInfo bufferInfo);

    ByteBuffer getAudioOutput();

    long render(long presentationTimeUs);
}
